cmake_minimum_required(VERSION 3.16)
project(CXCommon)

# 设置 C++ 标准为 C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets MultimediaWidgets Network)
if(Qt6_FOUND)
    message(STATUS "CXCommon Found Qt6")
else()
    message(FATAL_ERROR "Qt not found")
endif()


include_directories(${CMAKE_CURRENT_SOURCE_DIR})


set(SOURCES
        Common.cpp
        UtilDataBase.cpp
        UtilNetWork.cpp
        UtilQtStyle.cpp
        UtilSystem.cpp
        UtilWidget.cpp
        )

set(HEADERS
        Common.h
        SingletonTmpl.h
        UString.h
        UtilDataBase.h
        UtilNetWork.h
        UtilQtStyle.h
        UtilSystem.h
        UtilWidget.h
        )

# 创建库
add_library(CXCommon ${SOURCES} ${HEADERS})

file(GLOB SRC_LIST ${SOURCES} ${HEADERS})

# 链接 Qt 模块
target_link_libraries(CXCommon PUBLIC
        Qt::Core
        Qt::Gui
        Qt::Widgets
        Qt::Sql
        Qt::Network
        )

target_include_directories(CXCommon PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
